<?php

namespace app\common\model;

use think\Env;
use think\Exception;
use think\Model;

/**
 * 模型
 */
class MaintainRecord extends Model
{

    // 表名
    protected $name = 'maintain_record';

    protected $deleteTime = false;
    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;


    // 追加属性
    protected $append = [

    ];

    public function shop()
    {
        return $this->belongsTo('shop', 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function images()
    {
        return $this->hasMany(MaintainRecordImage::class, 'maintain_record_id');
    }


    public function getCreatetimeAttr($value) {
        return $value ? date('Y.m.d H:i:s',$value) : '';
    }











}
